package com.wish.wishsystem_management.controller;

import com.github.pagehelper.PageInfo;
import com.wish.wishsystem_management.api.SysLog;
import com.wish.wishsystem_management.entity.SysInterfaceInfo;
import com.wish.wishsystem_management.service.ISysInterfaceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.Queue;


/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhaiwj
 * @since 2021-03-22
 */
@RestController
@RequestMapping("/sysInterfaceInfo")
public class SysInterfaceInfoController {


    @Autowired
    ISysInterfaceInfoService sysInterfaceInfoService;

    @RequestMapping("list")
    public PageInfo<SysInterfaceInfo> selectIntefaceAll(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, SysInterfaceInfo interfaceInfo) {
        PageInfo<SysInterfaceInfo> info = sysInterfaceInfoService.queryList(pageNum, pageSize, interfaceInfo);
        return info;
    }

    @SysLog("保存配置")
    @RequestMapping("add")
    public boolean saveInterface(@RequestBody SysInterfaceInfo sysInterfaceInfo) {

        sysInterfaceInfoService.save(sysInterfaceInfo);

        return true;
    }

    @SysLog("删除配置")
    @RequestMapping("delete")
    public boolean delete(String[] ids) {
        for (String id : ids
        ) {
            sysInterfaceInfoService.deleteAll(id);
        }
        return true;
    }

    @SysLog("根据唯一主键查询所有数据")
    @RequestMapping("selectAllById")
    public SysInterfaceInfo selectAllById(Integer id) {

        return sysInterfaceInfoService.getById(id);
    }

    @RequestMapping("/update")
    public boolean update(@RequestBody SysInterfaceInfo sysInterfaceInfo) {
        boolean b = sysInterfaceInfoService.updateAll(sysInterfaceInfo);
        return b;
    }

}

